/** @file GameState.h
    @class GameState
    @brief A child of State that initializes the in-game demo state and updates the controllers
*/

#include "stdafx.h"
#include "State.h"
#include "GameObject.h"
#include "PlayerAvatar.h"
#include "MusicController.h"
#include "AvatarController.h"
#include "ReplayController.h"
#include "SpectatorController.h"
#include "InGameGUIController.h"
#include "Player.h"
#include "Input.h"
#include <string>
#include "Penguin.h"
#include "OgreParticleSystemManager.h"
#include "GUI.h"

#ifndef _GAMESTATE_H_
#define _GAMESTATE_H_


class GameState : public State {
public:
	/**
	* @brief The constructor
	*/
	GameState(string ip, bool replay);

	/**
	* @brief The destructor
	*/
	~GameState();

	/**
	* @brief The initialize method. Populates the model and adds the controllers
	*/
	virtual void initalize(Ogre::RenderWindow* window);

	/**
	* @brief Adds player avatar
	*/
	void addPlayerAvatar(PlayerAvatar* avatar, bool replay, Ogre::Camera* camera, Model* model);

	/**
	* @brief The update method, inherited from State
	*
	* Executed the commandlist, updates the physics, makes sure the guicontroller is following the currently active player,
	* updates the position of the camera and sound listener, 
	*/
	virtual bool update(float deltaTime);

	/**
	* @brief Returns the model from m_model
	*/
	Model* getModel();

	/**
	* @brief Returns the avatarcontroller in m_aCtrl
	*/
	AvatarController* getAvatarController();

protected:

private:
	bool m_replay;
	Ogre::RenderWindow* window;
	Ogre::Camera* m_camera;
	Model* m_model;
	AvatarController* m_aCtrl;
	MusicController* m_mCtrl;
	ReplayController* m_rCtrl;
	SpectatorController* m_cCtrl;
	NetworkController* m_networkCtrl;
	InGameGUIController* m_gCtrl;
	Player* m_pCtrl;

	/**
	* @brief Used in update to give the right playeravatar to the GUI controller
	*/
	PlayerAvatar* tmp;
	std::string ip;
};

#endif // _GAMESTATE_H_